package opensource.xinye.com.test11.jni;

import android.widget.EditText;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class Socket {
    static {
        System.loadLibrary("study");
    }

    private Callback mCallback;

    public Socket(Callback callback){
        this.mCallback = callback;
    }

    public native void nativeStartTcpServer(int port) throws Exception;
    public native void nativeStartClient(String ip,int port,String message) throws Exception;
    public native void nativeStartUdpServer(int port);
    public native void nativeStartUdpClient(@NotNull String ip, int port, @NotNull String message);
    public native void nativeStartLocalServer(String socketName);

    public void logMessage(String message){
        if(mCallback != null){
            mCallback.onMessageShow(message);
        }
    }



    public interface Callback{
        void onMessageShow(String message);
    }
}
